<?php

namespace App\Http\Controllers;

use App\Http\Requests\SettingRequest;
use Iamxcd\LaravelCRUD\Traits\HasResponse;

class SettingController extends Controller
{
    use HasResponse;
    public function __construct()
    {
        $this->request = app(SettingRequest::class);
    }

    public function sysSetting()
    {
        $request = $this->request;
        $data = $request->validated();
        setting(['sys' => $data])->save();
        return $this->responseMessage('设置成功');
    }

    public function getSysSettings()
    {
        $data = setting('sys');
        return  $this->response($data, '获取成功');
    }
}
